Chen Yulin's BlogChen Yulin's Blog
HomeArchivesCategoriesTagsAbout
  目录
ChemGPT
Posted 2025-11-27Updated 2025-11-28Review3 minutes read (About 511 words)   visits

ChemGPT

Base Model

ChemGPT 早期基座模型基于 EleutherAI 的语言模型 GPT‑Neo,在分子字符串语料(SMILES 或 SELFIES)上进行自回归建模。
典型预训练数据集为公开的大规模分子库 PubChem10M,参数规模覆盖百万到十亿级别(如约 4.7M 的轻量版本或 100M+ 的科研版本)。
属于领域特化的 decoder-only 化学语言模型。

Training Method

  • 对分子进行编码:对 SMILES/SELFIES/反应式进行 tokenization,构建化学“语言”词表(原子、键、环、分支、立体标记等均被离散化为 token)
  • 预训练目标:自回归分子语言建模(Next-token prediction),最大化生成合法分子序列的对数似然。

调用方式

网页直接使用

https://www.chemgpt.app/
(我没有注册账号,直接问会显示网络繁忙)

### Huggingface 下载模型并调用 当前 HF Hub 上最常被引用的 ChemGPT 版本包括: - 轻量模型:ChemGPT 4.7M (https://huggingface.co/ncfrey/ChemGPT-4.7M) - 中型模型:ChemGPT 1.2B (https://huggingface.co/ncfrey/ChemGPT-1.2B)

模型推理(文本生成 Pipeline)

text-generation pipeline 适合生成式任务(包括化学问答、分子生成)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline

chem_pipe = pipeline(
"text-generation",
model="ncfrey/ChemGPT-1.2B", # 或 ncfrey/ChemGPT-4.7M
device_map="auto"
)

prompt = "CCO>>" # 以乙醇为前缀生成分子衍生结构或产物候选
result = chem_pipe(
prompt,
max_new_tokens=128,
temperature=0.7,
do_sample=True
)

print(result[0]["generated_text"])

模型推理(直接使用 model.generate)

当需要精细控制 token 级生成时,直接调用 generate API。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "ncfrey/ChemGPT-1.2B" # 或 Chemistry 结构生成模型 ncfrey/ChemGPT-4.7M
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
model.eval()
model.to("cuda" if torch.cuda.is_available() else "cpu")

prompt = "CCO>>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.6,
top_p=0.95
)

generated = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(generated)

ChemGPT

http://chen-yulin.github.io/2025/11/27/[OBS]Chemistry-ChemGPT/

Author

Chen Yulin

Posted on

2025-11-27

Updated on

2025-11-28

Licensed under

#Research-paperLLMChemistry
Lec8

Comments

Chen Yulin

Chen Yulin

SJTU student

Manchester by the Sea

Posts

292

Categories

10

Tags

203

Follow

Catalogue

  • Base Model
  • Training Method
  • 调用方式
    • 网页直接使用
      • 模型推理(文本生成 Pipeline)
      • 模型推理(直接使用 model.generate)

Archives

  • November 20256
  • October 20253
  • September 20253
  • August 20256
  • July 20255
  • June 20256
  • May 202510
  • April 202517
  • March 202545
  • February 202512
  • January 202513
  • December 202412
  • November 20244
  • October 202418
  • September 202416
  • August 202413
  • July 20243
  • June 20245
  • May 202413
  • April 202417
  • March 20241
  • January 20241
  • December 20231
  • May 202346
  • August 20221
  • May 20226
  • April 20229

Recents

ChemGPT

2025-11-27

ChemGPT

Review

Lec8

2025-11-24

Lec8

Note

DREAM TO CONTROL= LEARNING BEHAVIORS  BY LATENT IMAGINATION

2025-11-22

DREAM TO CONTROL= LEARNING BEHAVIORS BY LATENT IMAGINATION

Review

奠定世界模型= Intelligence without representation

2025-11-21

奠定世界模型= Intelligence without representation

Review

2025-11-12

ROS2 Basic

Note

Tags

3D-Scene4
6-D3
AI12
AIGC1
API1
AR2
Academic1
Algorithm1
Aliyun1
App2
Atlas1
BS41
Beautify1
Behaviorism1
Business1
C1
CADC1
CD1
CLIP5
CNN1
CV30
Capstone10
Chemistry1
Communication2
Contrastive-Learning3
Control2
Csharp9
Css1
Cuda3
DD1
DINO4
DT1
Dataframe1
Debate5
Debugger1
Diffusion1
Discrete-Mathematics1
Disney1
Docker1
Docs2
Dynamic-programming1
ESP322
Education1
Embeded-System9
Embodied-AI10
Emoation1
Emotion13
Ethic1
Experiment2
FL1
FPN2
Family1
Federated-Learning1
Foundation1
Functional programming1
GPT3
Game5
Gated-NN2
Git7
Github1
Godot3
Graph1
HPC1
HRI2
Haskell1
Health2
Hexo10
Hierarchical1
Html5
Humanism1
Hyprland2
IK1
Image-Grounding1
Image-Text5
Image-generation1
ImitationLearning3
Jolt1
Json1
LLM14
LSP2
Latex2
Lego1
Life4
LinearAlgebra1
Linux22
Live2d1
Love4
Lua1
MBTI1
ML8
MR/AR3
Mason1
Math6
Meme1
Message-Passing1
MindPlus1
Mod3
Motivation1
Moveit1
Movie1
Multi-Agent1
Multi-modal6
Multi-view1
Music5
NLP4
NN7
Network2
Nodejs5
Numpy1
Nvim9
Object-Detection4
Open-Vocabulary9
OpenCV1
Oral1
PHD1
PSY5
Pandas2
Panoptic1
Path1
Philosophy3
PhysX1
Physical-Scene4
Physics-engine1
Pio2
Planning1
Plugin8
PoseEstimation3
Postgraduate1
Prefab1
Probability1
Python29
Pytorch1
QML1
Quantum1
RAG1
RL1
RNN4
ROS6
Reading19
Real2Sim1
Reconstruct9
Regex2
Reinforcement-learning1
Repository5
Representation-Learning1
Research-paper89
Robot4
Robotics18
SJTU-Lecture1
SQL2
SSH3
Scene-graph31
Scene-synthesis1
Science-fiction1
Scrap1
Script2
Segmentation7
Semantic12
Shader3
Shell4
Signals and Systems1
Sim2Real1
Sklearn1
Snippets1
Society4
Star-rail1
Subgraph1
Submodule1
Supervised-learning2
Survey3
TC1
TOEFL1
Task-Planning6
Tasks5
Tech Communication1
Torch5
Transformer11
Translation-Embedding2
Travel5
Unity20
Unsupervised-learning1
VLM6
VLP2
Version-management1
ViT4
VideoEditing2
Vim1
Visual-Relation20
WSL1
Waybar1
Wayland1
Web1
Website1
Well-being1
Window-manager2
WorldModel2
YKLL3
Zen2
♥️2
🍢1
🍰1
🐱2
🧀1
Chen Yulin's BlogChen Yulin's Blog

© 2025 Chen Yulin  Powered by Hexo & Icarus

×